package ym.ecrm.core.dto.systemManagement;

import java.lang.reflect.InvocationTargetException;
import java.util.Date;

import javax.persistence.Column;

import org.apache.commons.beanutils.BeanUtils;

import ym.ecrm.core.domain.systemManagement.Role;

public class RoleDTO {
	
	private Long roleId;
	private String roleCode;
	private String roleName;
	private String buildIn;
	private Long parent;
	private String description;
	
	public static void entity2dto(Role role, RoleDTO roleDTO){
		try {
			BeanUtils.copyProperties(roleDTO, role);
			roleDTO.setRoleId(role.getId());
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			e.printStackTrace();
		}
	}
	
	public static void dto2entity(RoleDTO roleDTO, Role role){
		try {
			BeanUtils.copyProperties(role, roleDTO);
			role.setId(roleDTO.getRoleId());
		} catch (IllegalAccessException e) {
			e.printStackTrace();
		} catch (InvocationTargetException e) {
			e.printStackTrace();
		}
		
	}
	
	public Long getRoleId() {
		return roleId;
	}
	public void setRoleId(Long roleId) {
		this.roleId = roleId;
	}
	public String getRoleCode() {
		return roleCode;
	}
	public void setRoleCode(String roleCode) {
		this.roleCode = roleCode;
	}
	public String getRoleName() {
		return roleName;
	}
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}

	public String getBuildIn() {
		return buildIn;
	}

	public void setBuildIn(String buildIn) {
		this.buildIn = buildIn;
	}

	public Long getParent() {
		return parent;
	}
	public void setParent(Long parent) {
		this.parent = parent;
	}
}
